.\"
.\" FreeBSD pkg - a next generation package for the installation and maintenance
.\" of non-core utilities.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\"
.\"     @(#)pkg.8
.\"
.Dd July 15, 2018
.Dt PKG-RQUERY 8
.Os
.Sh NAME
.Nm "pkg rquery"
.Nd query information from remote repositories
.Sh SYNOPSIS
.Nm
.Fl I Ns | Ns Ar query-format
.Ar pkg-name
.Nm
.Op Fl aU
.Op Fl r Ar reponame
.Fl I Ns | Ns Ar query-format
.Nm
.Op Fl U
.Fl e Ar evaluation-condition
.Op Fl r Ar reponame
.Fl I Ns | Ns Ar query-format
.Nm
.Op Fl U
.Op Fl Cgix
.Op Fl r Ar reponame
.Fl I Ns | Ns Ar query-format
.Ar pattern ...
.Sh DESCRIPTION
.Nm
is used for displaying information about remote packages.
.Pp
Package repository catalogues will be automatically updated whenever
.Nm
is run by a user ID with write access to the package database,
unless disabled by the
.Fl U
flag or setting
.Va REPO_AUTOUPDATE
to
.Dq Li NO
in
.Xr pkg.conf 5 .
.Sh OPTIONS
The following options are supported by
.Nm :
.Bl -tag -width Ds
.It Fl a , Fl -all
Match all packages from the database.
.It Fl C , Fl -case-sensitive
Make the standard or the regular expression
.Pq Fl x
matching against
.Ar pkg-name
case sensitive.
.It Fl e Ar evaluation-condition , Fl -evaluate Ar evaluation-condition
Match packages using the given
.Ar evaluation-condition.
See
.Sx EVALUATION FORMAT
for details.
.It Fl I , Fl -index-line
Print out the corresponding line from the ports
.Pa INDEX
file for each matched package.
This option is a shorthand
.Ar query-format
argument.
Only the first query format (including the
.Fl I
option) on the command line will be interpreted.
.It Fl r Ar reponame , Fl -repository Ar reponame
Query for data about packages from only the named repository,
irrespective of the configured
.Dq active
status from
.Pa repo.conf .
By default all repository catalogues marked
.Dq active
are queried.
.It Fl g , Fl -glob
Treat
.Ar pattern
as a glob pattern.
.It Fl i , Fl -case-insensitive
Make the standard or regular expression
.Pq Fl x
matching against
.Ar pkg-name
case insensitive.
This is the default, unless modified by setting
.Va CASE_SENSITIVE_MATCH
to
.Dq Li true
in
.Pa pkg.conf .
.It Fl U , Fl -no-repo-update
Suppress the automatic update of the local copy of the repository catalogue
from remote.
Automatic repository catalogue updates are only attempted when the
effective UID of the process has write access to the package database.
Otherwise they are silently ignored.
.It Fl x , Fl -regex
Treat
.Ar pattern
as a regular expression according to the
.Dq modern
or
.Dq extended
syntax of
.Xr re_format 7 .
.El
.Sh QUERY FORMAT
There are two types of keywords for the query format: the multiline and the
normal one.
Only one type of multiline pattern is accepted for a given query.
.Ss Normal patterns:
.Bl -tag -width Ds
.It Cm \&%R
Name of the repository the package is in
.It Cm \&%n
Name of the matched package
.It Cm \&%v
Version of the matched package
.It Cm \&%o
Origin of the matched package
.It Cm \&%p
Prefix of the matched package
.It Cm \&%m
Maintainer of the matched package
.It Cm \&%c
Comment of the matched package
.It Cm \&%e
Description of the matched package
.It Cm \&%w
Home page of the matched package
.It Cm \&%q
Architecture of the matched package
.It Cm \&%l
License logic of the matched package
.Pp
One of the following will be printed:
.Bl -tag -width " single " -compact
.It Dq single
if the package is distributed under one license
.It Dq and
if the package is multi-licensed
.It Dq or
if the package is dual-licensed
.El
.It Cm \&%s Ns Op Cm bh
The flat size of the matched package, where
.Cm b
is in bytes, and
.Cm h
is in human readable format
.It Cm \&%M
Message contained in the matched package
.It Cm \&%? Ns Op Cm drCOLBbA
Returns 0 if the list is empty and 1 if the list has information to display
.Bl -tag -width "d"
.It Cm d
for dependencies
.It Cm r
for reverse dependencies
.It Cm C
for categories
.It Cm O
for options
.It Cm L
for licenses
.It Cm B
for required shared libraries
.It Cm b
for provided shared libraries
.It Cm A
for annotations
.El
.It Cm \&%# Ns Op Cm drCOLBbA
Returns the number of elements in the list
.Bl -tag -width "d"
.It Cm d
for dependencies
.It Cm r
for reverse dependencies
.It Cm C
for categories
.It Cm O
for options
.It Cm L
for licenses
.It Cm B
for required shared libraries
.It Cm b
for provided shared libraries
.It Cm A
for annotations
.El
.El
.Ss Multiline patterns:
.Bl -tag -width Ds
.It Cm \&%d Ns Op Cm nov
Expands to the list of dependencies for the matched package, where
.Cm n
stands for the package name,
.Cm o
for the package origin, and
.Cm v
for the package version.
.It Cm \&%r Ns Op Cm nov
Expands to the list of reverse dependencies for the matched package, where
.Cm n
stands for the package name,
.Cm o
for the package origin, and
.Cm v
for the package version.
.It Cm \&%C
Expands to the list of categories the matched package belongs to.
.It Cm \&%O Ns Op Cm kvdD
Expands to the list of options of the matched package, where
.Cm k
stands for option key
.Cm v
for option value,
.Cm d
for option default value, and
.Cm D
for option description.
Option default values and descriptions are optional metadata and may
be blank for certain packages or repositories.
.It Cm \&%L
Expands to the list of license(s) for the matched package.
.It Cm \&%B
Expands to the list of shared libraries used by programs from the matched package.
.It Cm \&%b
Expands to the list of shared libraries provided by the matched package.
.It Cm \&%A Ns Op Cm tv
Expands to the list of annotations associated with the matched
package, where
.Cm t
stands for the annotation tag, and
.Cm v
stands for the annotation value.
.El
.Sh EVALUATION FORMAT
.Ss Variables
.Bl -tag -width Ds
.It Cm \&%n
Name of the package (type string)
.It Cm \&%o
Origin of the package (type string)
.It Cm \&%p
Prefix of the package (type string)
.It Cm \&%m
Maintainer of the package (type string)
.It Cm \&%c
Comment of the package (type string)
.It Cm \&%e
Description of the package (type string)
.It Cm \&%w
WWW address of the package (type string)
.It Cm \&%s
Flatsize of the package (type integer)
.It Cm \&%a
Automatic status of the package (type integer)
.It Cm \&%q
Architecture of the package (type string)
.It Cm \&%M
Message of the package (type string)
.It Cm \&%# Ns Op drCOLBbA
Number of elements in the list of information (type integer).
See
.Cm %?
above for what information is used.
.El
.Ss Operators
.Bl -tag -width Ds
.It Va var Cm ~ Ar glob
The string value of
.Va var
matches the given glob pattern.
.It Va var Cm !~ Ar glob
The string value of
.Va var
does not match the given glob pattern.
.It Va var Cm > Ns Oo = Oc Ar num
The numerical value of
.Va var
is greater than
.Op or equal to
the given number.
.It Va var Cm < Ns Oo = Oc Ar num
The numerical value of
.Va var
is less than
.Op or equal to
the given number.
.It Va var Cm = Ns Oo = Oc Ar num
The numerical value of
.Va var
is equal to the given number.
.It Va var Cm != Ar num
The numerical value of
.Va var
is not equal to the given number.
.El
.Sh ENVIRONMENT
The following environment variables affect the execution of
.Nm .
See
.Xr pkg.conf 5
for further description.
.Bl -tag -width Ds
.It Ev PKG_DBDIR
.It Ev CASE_SENSITIVE_MATCH
.El
.Sh FILES
See
.Xr pkg.conf 5 .
.Sh EXIT STATUS
.Ex -std
.Sh EXAMPLES
See
.Xr pkg-query 8
for example usage.
.Sh SEE ALSO
.Xr pkg_printf 3 ,
.Xr pkg_repos 3 ,
.Xr pkg-repository 5 ,
.Xr pkg.conf 5 ,
.Xr pkg 8 ,
.Xr pkg-add 8 ,
.Xr pkg-alias 8 ,
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
.Xr pkg-create 8 ,
.Xr pkg-delete 8 ,
.Xr pkg-fetch 8 ,
.Xr pkg-info 8 ,
.Xr pkg-install 8 ,
.Xr pkg-lock 8 ,
.Xr pkg-query 8 ,
.Xr pkg-register 8 ,
.Xr pkg-repo 8 ,
.Xr pkg-search 8 ,
.Xr pkg-set 8 ,
.Xr pkg-shell 8 ,
.Xr pkg-shlib 8 ,
.Xr pkg-ssh 8 ,
.Xr pkg-stats 8 ,
.Xr pkg-update 8 ,
.Xr pkg-updating 8 ,
.Xr pkg-upgrade 8 ,
.Xr pkg-version 8 ,
.Xr pkg-which 8
